Skip to content

chore(ci): run the Playwright E2E suite as three parallel shards - #120

Merged
Rushaway merged 10 commits into
mainfrom
chore/ci-e2e-shards
Nov 29, 2026
Merged

Rushaway merged 10 commits into
mainfrom
chore/ci-e2e-shards

Conversation

@Rushaway

@Rushaway Rushaway commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Problem

The E2E job runs 780 tests on one worker (workers: 1, because every spec shares the sourcebans_e2e database), so it took 586 s on the PR #114 run, 477 s of it in Run E2E (#115).

Change

  • e2e.yml: a matrix shard: [1, 2, 3] with fail-fast: false. Each job brings up its own dev stack (so its own sourcebans_e2e) and runs ./sbpp.sh e2e --shard=N/3 --reporter=blob,list. workers: 1 inside each stack does not change.
  • Why 3: Playwright cuts contiguous slices by test count. From the per-test durations in the fix(web): restore the system log search and fix the message filter #114 log (428 s of tests), three slices carry 158 / 132 / 138 s. Four would leave one at 175 s, because the mobile project skips most of its tests.
  • On failure, the shards upload blob-report-N and playwright-test-results-N, and a report job (if: failure(), so no wall time on a green run) merges the blob reports into the usual playwright-report HTML artifact.
  • Same 780 tests, same two projects (chromium, mobile-chromium), same retries: 1 + failOnFlakyTests.
  • AGENTS.md (Playwright E2E specifics) documents the shards.

Checked

  • npx playwright test --list --shard=N/3 locally: 260 + 260 + 260 = 780, the same as the unsharded --list (780 tests in 96 files).
  • actionlint: no finding.
  • CI (run 46277851381): Running 260 tests using 1 worker, shard N of 3 in each job; 188 + 101 + 140 = 429 passed, 72 + 159 + 120 = 351 skipped, the same totals as the single job on fix(web): restore the system log search and fix the message filter #114 (429 / 351).
  • CI timings: E2E workflow 586 s -> 369 s wall. Per shard, job 345-363 s: Bring up the dev stack 120-128 s (the image build, cut by chore(ci): build the E2E dev image with the GitHub Actions cache #122), Run E2E 207-233 s.
  • Later commit: the shard total comes from strategy.job-total, so a fork with one runner can set shard: [1].
  • Not checked: the report job (it only runs after a failure).

Version

2.2.29 -> 2.2.30 (stacked on #119)

Merge order

Stack for #115, squash one at a time from the bottom:

  1. chore(ci): cancel the outdated run when a pull request is pushed again #116 chore(ci): cancel the outdated run on a new PR push (2.2.26)
  2. chore(ci): run PHPUnit and E2E nightly on main instead of on every push #117 chore(ci): PHPUnit + E2E nightly on main instead of on every push (2.2.27)
  3. perf(tests): seed the fixture admin with a precomputed password hash #118 perf(tests): precomputed fixture admin password hash (2.2.28)
  4. chore(ci): run the PHPUnit MariaDB on tmpfs without fsync #119 chore(ci): PHPUnit MariaDB on tmpfs without fsync (2.2.29)
  5. chore(ci): run the Playwright E2E suite as three parallel shards #120 chore(ci): Playwright E2E as three parallel shards (2.2.30)
  6. perf(tests): reset the fixture tables with DELETE instead of TRUNCATE #121 perf(tests): fixture reset with DELETE instead of TRUNCATE (2.2.31)
  7. chore(ci): build the E2E dev image with the GitHub Actions cache #122 chore(ci): E2E dev image built with the gha cache (2.2.32)
  8. fix(e2e): wait for the settings bounce in the password generator spec #123 fix(e2e): password generator spec waits for the settings bounce (2.2.33)

Every workflow that runs on pull requests gets a concurrency group keyed
on the PR number, with cancel-in-progress. Other events (push, tag,
schedule, manual) key on the run id, so they never cancel or queue
behind each other.

Refs #115
The merged commit already passed both suites on its pull request. A push
to main now runs only the fast gates (PHPStan, ts-check, API contract,
plugin build). PHPUnit and the Playwright E2E suite run on pull
requests, every night on main, and on demand.

Refs #115
Fixture::reset() runs before every test and re-seeded the admin row with
a fresh password_hash(). bcrypt costs 12 by default since PHP 8.4, about
0.22 s a hash, so ~1,770 resets spent most of the PHPUnit run hashing
the same password. The hash is now computed once per process.

BansTest (80 tests) locally: 24 s -> 8 s, same assertions.

Refs #115
Fixture::reset() truncates and re-seeds every table before each test,
so the job was bound by fsync. MariaDB now starts from a step (a service
container cannot pass server options) with its datadir on tmpfs,
innodb_flush_log_at_trx_commit=0, no doublewrite buffer and no binlog.
It boots while PHP and Composer install, listens on a free loopback
port, has a per-run name, and is removed when the job ends, so a
self-hosted runner keeps no leftover container.

BansTest (80 tests) locally: 43-49 s on disk -> 8-9 s on tmpfs.

Refs #115
The suite ran on one worker because every spec shares the
sourcebans_e2e database. Each shard now brings up its own dev stack and
database and runs --shard=N/3, so workers: 1 no longer sets the total
time. From the per-test durations of the PR #114 run (428 s of tests),
the three contiguous slices carry 158 / 132 / 138 s. fail-fast is off,
so a red run still lists every failing spec, and on failure a report job
merges the shards' blob reports into the usual playwright-report
artifact.

Refs #115
Hashing once per process still cost 0.22 s in every
#[RunInSeparateProcess] child (165 tests) and on every E2E reset, which
runs in a fresh process. The fixture now seeds a precomputed cost-12
bcrypt hash of 'admin': same password, cost and format, and
password_needs_rehash() stays false.

Refs #115
Base automatically changed from chore/ci-phpunit-tmpfs-db to main November 29, 2026 15:40
@Rushaway
Rushaway marked this pull request as ready for review November 29, 2026 15:40
@Rushaway
Rushaway merged commit 76d6c66 into main Nov 29, 2026
5 checks passed
@Rushaway
Rushaway deleted the chore/ci-e2e-shards branch November 29, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci GitHub Actions workflows and test harness chore Build, tests or tooling, no user-facing change priority: medium Normal priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant